<?php

// uncomment the following to define a path alias
// Yii::setPathOfAlias('local','path/to/local-folder');

// This is the main Web application configuration. Any writable
// CWebApplication properties can be configured here.
return array(
	'basePath'=>dirname(__FILE__).DIRECTORY_SEPARATOR.'..',
	'name'=>'Автомойка',
	'sourceLanguage' => 'ru', 'language' => 'ru',

	// preloading 'log' component
	#'preload'=>array('log'),

	// autoloading model and component classes
	'import'=>array(
		'application.models.*',
		'application.models.behaviors.*',
		'application.components.*',
		'ext.nestedset.*',
		'application.helpers.*',
		'application.components.shoppingCart.*',
	),
	
	'modules'=>array(
		'gii'=>array(
			'class'=>'system.gii.GiiModule',
			'password'=>'123',
			'ipFilters'=>array('127.0.0.1','::1'),
		),
		'admin'=>array(
			'modules'=>array(
				'catalog'=>array(
					'defaultController'=>'Brands',
				),
			),
			'defaultController'=>'Articles',
		)
	),

	// application components
	'components'=>array(
		'shoppingCart'=>array(
			'class'=>'application.components.shoppingCart.EShoppingCart',
		),
		'file'=>array(
			'class'=>'ext.file.EFile',
		),
		'zip'=>array(
			'class'=>'ext.zip.EZip',
		),
		'user'=>array(
			// enable cookie-based authentication
			'allowAutoLogin'=>true,
		),
		// uncomment the following to enable URLs in path-format
		'urlManager'=>array(
			'urlFormat'=>'path',
			'showScriptName'=>false,
			'rules'=>array(
				'admin/'=>'admin',
				'admin/<controller:\w+>'=>'admin/<controller>',
				'admin/<controller:\w+>/<action:\w+>'=>'admin/<controller>/<action>',
				'admin/<submodule>/<controller:\w+>/<action:\w+>'=>'admin/<submodule>/<controller>/<action>',

				
				'login/'=>'site/login',
				'logout/'=>'site/logout',
				'captcha' => 'contacts/captcha',
		
				'catalog/<action:(tyres|disks)>/<aliasProducer:([\w-\.]+)>/<aliasModel:([\w-\.]+)>/<aliasSize:([\d]+)-[\w-\.]+>' => array('catalog/<action>', 'urlSuffix'=>'.html'),
				'catalog/<action:(tyres|disks)>/<aliasProducer:([\w-\.]+)>/<aliasModel:([\w-\.]+)>' => array('catalog/<action>', 'urlSuffix'=>'.html'),
				'catalog/<action:(tyres|disks)>/<aliasProducer:([\w-\.]+)>' => array('catalog/<action>', 'urlSuffix'=>'.html'),

				'<controller:(catalog|selection)>/<action:(tyres|disks)>' => array('<controller>/<action>', 'urlSuffix'=>'.html'),
				
				'<controller:\w+>'=>'<controller>/index',
				'<controller:\w+>/<action:\w+>'=>'<controller>/<action>',
				'<controller:\w+>/<alias:[\w|-]+>'=>'<controller>/view',
				'<controller:\w+>/<id:\d+>'=>'<controller>/view',
				'<controller:\w+>/<action:\w+>/<id:\d+>'=>'<controller>/<action>',
			),
		),
		// uncomment the following to use a MySQL database
		'db'=>array(
			'connectionString' => 'mysql:host=washservic.mysql;port=3306;dbname=washservic_main',
			'emulatePrepare' => true,
			'username' => 'washservic_main',
			'password' => 'itiac8vq',
			'charset' => 'UTF8',
			'enableProfiling' => true,
		),
		'errorHandler'=>array(
			// use 'site/error' action to display errors
            'errorAction'=>'site/error',
    	),

		'log'=>array(
			'class'=>'CLogRouter',
			'routes'=>array(

				array(
					'class'=>'CFileLogRoute',
					'levels'=>'error, warning',
				),

				// uncomment the following to show log messages on web pages

				array(
					'class'=>'CWebLogRoute',
					'levels'=>'error, warning',
				),
			),
		),
		
	),

	// application-level parameters that can be accessed
	// using Yii::app()->params['paramName']
	'params'=>array(
		// this is used in contact page
		'email'=>'tigokr@gmail.com',
		'postsPerPage'=>20,
		'yandex'=>array(
			'key'=>'AO1jBkwBAAAAH5Z7fAIA6wsXQOqqZdZpPpjfu11G0-Neh0IAAAAAAAAAAAA-6Tc78yWoNZfpvkN1BG6c6pWcZw==',
			#'key'=>'AG0Mo00BAAAAA4qfNgIAKNNcYCY5krhu6wMs1ioJFBbxVRMAAAAAAAAAAACyxszyz1WzG7uJtVenMEwhhA2x6w==',
		),
	),
);

function d($var = false, $showHtml = false, $showFrom = true){
	if ($showFrom) {
			$calledFrom = debug_backtrace();
			echo '<strong>' . $calledFrom[0]['file'] . '</strong>';
			echo ' (line <strong>' . $calledFrom[0]['line'] . '</strong>)';
	}
	echo "\n<pre class=\"debug\">\n";
	
	$var = print_r($var, true);
	if ($showHtml) {
		$var = str_replace('<', '&lt;', str_replace('>', '&gt;', $var));
	}
	echo $var . "\n</pre>\n\n";
}